<?php
	include 'apns.php';
	
	$message = $_REQUEST['message'];
	$type = $_REQUEST['type'];
	if ($type == 0) {
		$query = "SELECT DISTINCT token FROM t_token";
	}
	elseif ($type == 1){
		$query = "SELECT DISTINCT token FROM t_token WHERE ibt_on=1";
	}
	elseif ($type == 2){
		$query = "SELECT DISTINCT token FROM t_token WHERE gmat_on=1";
	}
	elseif ($type == 3){
		$query = "SELECT DISTINCT token FROM t_token WHERE gre_on=1";
	}
	$result = mysql_query($query);
	$tokens = array();
	while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
	{
		$deviceToken = $row['token'];
		$tokens[] = $deviceToken;
	}
	pushNotificationToAllUsers($tokens, $message, 1);
	
?>